-
Notifications
You must be signed in to change notification settings - Fork 489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Add PoissonNLL loss #2765
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for the addition 🙂
Just some minor changes left
/edit: also, ignore the audit failure on the CI - this is fixed on main.
loss_sum.into_data().assert_approx_eq(&expected, 5); | ||
} | ||
|
||
#[test] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TestAutodiffBackend
type is under the std
feature flag, so we probably need to guard this test.
#[test] | |
#[cfg(feature = "std")] | |
#[test] |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2765 +/- ##
==========================================
+ Coverage 83.57% 83.62% +0.05%
==========================================
Files 824 825 +1
Lines 108453 108686 +233
==========================================
+ Hits 90639 90893 +254
+ Misses 17814 17793 -21 ☔ View full report in Codecov by Sentry. |
Thanks for the review @laggui! Just pushed the requested changes! :) |
Pull Request Template
Checklist
run-checks all
script has been executed.Related Issues/PRs
This PR addresses issue #2751.
Changes
This PR introduces the
PoissonNLLLoss
module, implementing the Poisson negative log-likelihood loss function.In particular I followed the
pytorch
implementation to make the transition from PyTorch as smooth as possible for users.Key additions:
PoissonNLLLossConfig
: Configuration structure with parameters forlog_input
,full
, andeps
.PoissonNLLLoss
: Implements forward and element-wise loss computation with optional reduction (Mean
,Sum
).Testing
log_input
istrue
andfalse
.full
is enabled.eps
).